In order to implement fast forwarding of a data packet, there is a segment routing (SR) technology in the prior art. Before a packet is forwarded, a source node establishes, according to a forwarding requirement, a forwarding path (Label Switching Path, LSP) between the source node and a destination node, determines information such as a node and a link on the LSP, and a service to be performed by the node, and adds, in a form of a label stack, the information to the to-be-forwarded packet. In this way, after receiving the packet, a forwarding node on the LSP may perform subsequent processing according to the meaning indicated by a topmost label of the label stack. For example, when the topmost label of the stack is a service segment identification (SID), the forwarding node may perform a service represented by the service SID; when the topmost label is a node SID, the forwarding node may forward the packet to a node represented by the node SID; when the topmost label is a link SID, an intermediate node may perform link-based forwarding according to an indication of the link SID, to forward the packet to a peer node of the intermediate node.
Therefore, it can be known that when the forwarding node forwards the packet along the LSP, if the determined information such as the node and the link on the LSP, and the service to be performed by the node is more, the label stack pushed into the packet is nested with multiple layers of labels, resulting in an excessive large length of the label stack. As a result, a length of the forwarded packet is greatly increased, which is not conducive to transmitting the packet in a network.